
<Html>
	<Head>
		<Title></Title>
		<link rel=Stylesheet type="text/css" href="main.css" />
		<script language="javascript" src="ECCIT.Script.Core/ECCIT.Script.Core.js"></script>
		<script language="javascript" src="ECCIT.Script.Core/ECCIT.Script.Core.BaseTypes.js"></script>
		<script language="javascript" src="ECCIT.Script.View/ECCIT.Script.View.Configuration/zh-cn/ECCIT.Script.View.Configuration.Message.js"></script>
		<script language="javascript" src="ECCIT.Script.View/ECCIT.Script.View.Configuration/ECCIT.Script.View.Configuration.Style.js"></script>
		<script language="javascript" src="ECCIT.Script.View/ECCIT.Script.View.Web.UI.WebControls.js"></script>
		
		<script language=javascript>
		<!--
		    Namespace.register("ECCIT.Test");
		    ECCIT.Test.TestCase = function(){};
		    ECCIT.Test.TestCase.Run = function(){alert("Test case running...");}
			var Decimal = ECCIT.Script.BaseTypes.Decimal;

			function test()
			{
			    //var Test = ECCIT.Test;
			    //Test.TestCase.Run();
			    var s = " hello world ";
			    alert(s.trim());
			    alert(s.trim() == "hello world");
				var IControl = ECCIT.Script.Web.UI.WebControls.IControl;
				var TextBox = ECCIT.Script.Web.UI.WebControls.TextBox;
				
				//var ctrl = new IControl("ctrl_1");
				//ctrl.getSaveValue();
				
				var tb = new TextBox("tb_1");
				tb.value = "hellow world";
				tb.originalValidate = tb.validate;
				tb.validate = function(){
				    var originalValid = tb.originalValidate();
				    
				    if (originalValid)
				    {
				        if (tb.getSaveValue() == "ronnie")
				        {
				            alert("user name ronnie is reserverd for internal user, you can not use it. Thanks!!!");
				            return false;
				        }
				    }
				    
				    return originalValid;
				};
				tb.caption = "user name";
				tb.mandatory = true;
				//alert(tb.validate());
				//alert(typeof ECCIT.Web.UI.WebControls.Style.DisplayMode.Edit);
				alert("edit mode:");
				//tb.changeDisplayMode(ECCIT.Script.Web.UI.WebControls.Style.DisplayMode.Edit);
				//alert("view mode:");
				//tb.changeDisplayMode(ECCIT.Script.Web.UI.WebControls.Style.DisplayMode.View);
				//alert("query mode:");
				//tb.changeDisplayMode(ECCIT.Web.UI.WebControls.Style.DisplayMode.Query);
				//tb.getSaveValue();
				//alert();
			}
			
			function testInt()
			{
			    var i = Number.createInstance("sss");
			    alert(i.valueOf());
			    alert(Number.isNaN(i));
			    alert("length->" + i.length);
			    alert("scale->" + i.scale);
			}
			
			function testDropDownList(){
			    var DropDownList = ECCIT.Script.Web.UI.WebControls.DropDownList;
			    var ddl_1 = new DropDownList("ddl_1");
			    ddl_1.dataValueField = "ID";
			    ddl_1.dataTextField = "Name";
			    ddl_1.addItem("1", "Ronnie Liu");
			    ddl_1.addItem("2", "Stephen Wang");
			    ddl_1.htmlControl.value = "2";
			    //ddl_1.setEnabled(false);
			    
			    //ddl_1.changeDisplayMode(ECCIT.Script.Web.UI.WebControls.Style.DisplayMode.Edit);
				alert("view mode:");
				ddl_1.changeDisplayMode(ECCIT.Script.Web.UI.WebControls.Style.DisplayMode.View);
				//alert(ddl_1.htmlControl.type);
				alert("edit mode:");
				ddl_1.changeDisplayMode(ECCIT.Script.Web.UI.WebControls.Style.DisplayMode.Edit);
			    //ddl_1.bindData();
			}
			
			function testRadioButtonList(){
			    var RadioButtonList = ECCIT.Script.Web.UI.WebControls.RadioButtonList;
			    var rbl_1 = new RadioButtonList("r");
			    //alert(rbl_1.items[0].nextSibling.nodeValue);
			    //rbl_1.setEnabled(false);
			    //rbl_1.clearItems();
			    //rbl_1.addItem("1", "ronnie", false);
			    //rbl_1.addItem("2", "stephen wang", false);
			    //rbl_1.addItem("3", "jiu chen", true);
			    rbl_1.setValue("3");
			    rbl_1.changeDisplayMode(ECCIT.Script.Web.UI.WebControls.Style.DisplayMode.View);
			}
			
			function testNormalDropDownList(){
			    var ddl = document.getElementById("ddl_2");
			    var option1 = document.createElement("option");
			    option1.value = "1";
			    option1.text = "1";
			    var option2 = document.createElement("option");
			    option2.value = "2";
			    option2.text = "2";
			    option2.selected = true;
			    ddl.options.add(option1);
			    ddl.options.add(option2);
			}

			function testNumber() {
			    var i = Number.createInstance(100000000, 8, 3);
			    alert(Number.isDecimal("100.1234", 8, 3));
			}

			function testDecimal() {
			    var s = "100.123";
			    var d = Decimal.parse(s);
			    d.validate();
            }
		//-->
		</script>
	</Head>
	<Body>
	    <input type=text id="tb_1" value="textbox 1" style="width:200px" />
		<input type=button value=test onclick="javascript:test()">
		<br /><input type=button value="test int" onclick="javascript:testInt()">
        <br /><input type=button value="test number" onclick="javascript:testNumber()">
        <br /><input type=button value="test decimal" onclick="javascript:testDecimal()">
		<br /><select id="ddl_1" style="width:200px"></select><input type=button value="test DropDownList" onclick="javascript:testDropDownList()">
		<br /><input type=radio value="1" name="r" id="r_1" >ronnie</input>
		<br /><input type=radio value="2" name="r" id="r_2" checked>stephen wang</input>
		<br /><input type=radio value="3" name="r" id="r_3">jiu chen</input><input type=button value="test radiobutton" onclick="javascript:testRadioButtonList()">
		<br /><select id="ddl_2" style="width:200px"></select><input type=button value="test DropDownList" onclick="javascript:testNormalDropDownList()">
	</Body>
</Html>
